home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / SpeechSynthesis.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  13.2 KB  |  515 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SpeechSynthesis.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1989-1997 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__SPEECHSYNTHESIS__') = 'UNDEFINED' THEN
  19. __SPEECHSYNTHESIS__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  28.     include 'Files.a'
  29.     ENDIF
  30.  
  31.  
  32. kTextToSpeechSynthType            EQU        'ttsc'
  33. kTextToSpeechVoiceType            EQU        'ttvd'
  34. kTextToSpeechVoiceFileType        EQU        'ttvf'
  35. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  36.  
  37. kNoEndingProsody                EQU        1
  38. kNoSpeechInterrupt                EQU        2
  39. kPreflightThenPause                EQU        4
  40.  
  41. kImmediate                        EQU        0
  42. kEndOfWord                        EQU        1
  43. kEndOfSentence                    EQU        2
  44.  
  45. ; ------------------------------------------
  46. ;  GetSpeechInfo & SetSpeechInfo selectors    
  47. ; ------------------------------------------
  48.  
  49. soStatus                        EQU        'stat'
  50. soErrors                        EQU        'erro'
  51. soInputMode                        EQU        'inpt'
  52. soCharacterMode                    EQU        'char'
  53. soNumberMode                    EQU        'nmbr'
  54. soRate                            EQU        'rate'
  55. soPitchBase                        EQU        'pbas'
  56. soPitchMod                        EQU        'pmod'
  57. soVolume                        EQU        'volm'
  58. soSynthType                        EQU        'vers'
  59. soRecentSync                    EQU        'sync'
  60. soPhonemeSymbols                EQU        'phsy'
  61. soCurrentVoice                    EQU        'cvox'
  62. soCommandDelimiter                EQU        'dlim'
  63. soReset                            EQU        'rset'
  64. soCurrentA5                        EQU        'myA5'
  65. soRefCon                        EQU        'refc'
  66. soTextDoneCallBack                EQU        'tdcb'                ; use with SpeechTextDoneProcPtr
  67. soSpeechDoneCallBack            EQU        'sdcb'                ; use with SpeechDoneProcPtr
  68. soSyncCallBack                    EQU        'sycb'                ; use with SpeechSyncProcPtr
  69. soErrorCallBack                    EQU        'ercb'                ; use with SpeechErrorProcPtr
  70. soPhonemeCallBack                EQU        'phcb'                ; use with SpeechPhonemeProcPtr
  71. soWordCallBack                    EQU        'wdcb'
  72. soSynthExtension                EQU        'xtnd'
  73. soSoundOutput                    EQU        'sndo'
  74.  
  75. ; ------------------------------------------
  76. ;  Speaking Mode Constants                     
  77. ; ------------------------------------------
  78.  
  79. modeText                        EQU        'TEXT'                ; input mode constants                     
  80. modePhonemes                    EQU        'PHON'
  81. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  82. modeLiteral                        EQU        'LTRL'
  83.  
  84.  
  85. soVoiceDescription                EQU        'info'
  86. soVoiceFile                        EQU        'fref'
  87.  
  88. SpeechChannelRecord        RECORD 0
  89. data                     ds.l    1                ; offset: $0 (0) <-- really an array of length one
  90. sizeof                     EQU *                    ; size:   $4 (4)
  91.                         ENDR
  92. ; typedef struct SpeechChannelRecord *    SpeechChannel
  93.  
  94.  
  95. VoiceSpec                RECORD 0
  96. creator                     ds.l    1                ; offset: $0 (0)
  97. id                         ds.l    1                ; offset: $4 (4)
  98. sizeof                     EQU *                    ; size:   $8 (8)
  99.                         ENDR
  100. ; typedef struct VoiceSpec *            VoiceSpecPtr
  101.  
  102.  
  103.  
  104. kNeuter                            EQU        0
  105. kMale                            EQU        1
  106. kFemale                            EQU        2
  107.  
  108.  
  109.  
  110. VoiceDescription        RECORD 0
  111. length                     ds.l    1                ; offset: $0 (0)
  112. voice                     ds        VoiceSpec        ; offset: $4 (4)
  113. version                     ds.l    1                ; offset: $C (12)
  114. name                     ds        Str63            ; offset: $10 (16)
  115. comment                     ds        Str255            ; offset: $50 (80)
  116. gender                     ds.w    1                ; offset: $150 (336)
  117. age                         ds.w    1                ; offset: $152 (338)
  118. script                     ds.w    1                ; offset: $154 (340)
  119. language                 ds.w    1                ; offset: $156 (342)
  120. region                     ds.w    1                ; offset: $158 (344)
  121. reserved                 ds.l    4                ; offset: $15A (346)
  122. sizeof                     EQU *                    ; size:   $16A (362)
  123.                         ENDR
  124.  
  125.  
  126. VoiceFileInfo            RECORD 0
  127. fileSpec                 ds        FSSpec            ; offset: $0 (0)
  128. resID                     ds.w    1                ; offset: $46 (70)
  129. sizeof                     EQU *                    ; size:   $48 (72)
  130.                         ENDR
  131. SpeechStatusInfo        RECORD 0
  132. outputBusy                 ds.b    1                ; offset: $0 (0)
  133. outputPaused             ds.b    1                ; offset: $1 (1)
  134. inputBytesLeft             ds.l    1                ; offset: $2 (2)
  135. phonemeCode                 ds.w    1                ; offset: $6 (6)
  136. sizeof                     EQU *                    ; size:   $8 (8)
  137.                         ENDR
  138.  
  139.  
  140. SpeechErrorInfo            RECORD 0
  141. count                     ds.w    1                ; offset: $0 (0)
  142. oldest                     ds.w    1                ; offset: $2 (2)
  143. oldPos                     ds.l    1                ; offset: $4 (4)
  144. newest                     ds.w    1                ; offset: $8 (8)
  145. newPos                     ds.l    1                ; offset: $A (10)
  146. sizeof                     EQU *                    ; size:   $E (14)
  147.                         ENDR
  148.  
  149.  
  150. SpeechVersionInfo        RECORD 0
  151. synthType                 ds.l    1                ; offset: $0 (0)
  152. synthSubType             ds.l    1                ; offset: $4 (4)
  153. synthManufacturer         ds.l    1                ; offset: $8 (8)
  154. synthFlags                 ds.l    1                ; offset: $C (12)
  155. synthVersion             ds        NumVersion        ; offset: $10 (16)
  156. sizeof                     EQU *                    ; size:   $14 (20)
  157.                         ENDR
  158.  
  159.  
  160. PhonemeInfo                RECORD 0
  161. opcode                     ds.w    1                ; offset: $0 (0)
  162. phStr                     ds        Str15            ; offset: $2 (2)
  163. exampleStr                 ds        Str31            ; offset: $12 (18)
  164. hiliteStart                 ds.w    1                ; offset: $32 (50)
  165. hiliteEnd                 ds.w    1                ; offset: $34 (52)
  166. sizeof                     EQU *                    ; size:   $36 (54)
  167.                         ENDR
  168.  
  169. PhonemeDescriptor        RECORD 0
  170. phonemeCount             ds.w    1                ; offset: $0 (0)
  171. thePhonemes                 ds        PhonemeInfo        ; offset: $2 (2) <-- really an array of length one
  172. sizeof                     EQU *                    ; size:   $38 (56)
  173.                         ENDR
  174. SpeechXtndData            RECORD 0
  175. synthCreator             ds.l    1                ; offset: $0 (0)
  176. synthData                 ds.b    2                ; offset: $4 (4)
  177. sizeof                     EQU *                    ; size:   $6 (6)
  178.                         ENDR
  179.  
  180. DelimiterInfo            RECORD 0
  181. startDelimiter             ds.b    2                ; offset: $0 (0)
  182. endDelimiter             ds.b    2                ; offset: $2 (2)
  183. sizeof                     EQU *                    ; size:   $4 (4)
  184.                         ENDR
  185.  
  186. ;
  187. ; pascal NumVersion SpeechManagerVersion(void )
  188. ;
  189.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  190.         Macro
  191.         _SpeechManagerVersion
  192.             move.l              #$0000000C,D0
  193.             dc.w                $A800
  194.         EndM
  195.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  196.         IMPORT_CFM_FUNCTION SpeechManagerVersion
  197.     ENDIF
  198.  
  199. ;
  200. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  201. ;
  202.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  203.         Macro
  204.         _MakeVoiceSpec
  205.             move.l              #$0604000C,D0
  206.             dc.w                $A800
  207.         EndM
  208.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  209.         IMPORT_CFM_FUNCTION MakeVoiceSpec
  210.     ENDIF
  211.  
  212. ;
  213. ; pascal OSErr CountVoices(short *numVoices)
  214. ;
  215.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  216.         Macro
  217.         _CountVoices
  218.             move.l              #$0108000C,D0
  219.             dc.w                $A800
  220.         EndM
  221.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  222.         IMPORT_CFM_FUNCTION CountVoices
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  227. ;
  228.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  229.         Macro
  230.         _GetIndVoice
  231.             move.l              #$030C000C,D0
  232.             dc.w                $A800
  233.         EndM
  234.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  235.         IMPORT_CFM_FUNCTION GetIndVoice
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal OSErr GetVoiceDescription(const VoiceSpec *voice, VoiceDescription *info, long infoLength)
  240. ;
  241.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  242.         Macro
  243.         _GetVoiceDescription
  244.             move.l              #$0610000C,D0
  245.             dc.w                $A800
  246.         EndM
  247.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  248.         IMPORT_CFM_FUNCTION GetVoiceDescription
  249.     ENDIF
  250.  
  251. ;
  252. ; pascal OSErr GetVoiceInfo(const VoiceSpec *voice, OSType selector, void *voiceInfo)
  253. ;
  254.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  255.         Macro
  256.         _GetVoiceInfo
  257.             move.l              #$0614000C,D0
  258.             dc.w                $A800
  259.         EndM
  260.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  261.         IMPORT_CFM_FUNCTION GetVoiceInfo
  262.     ENDIF
  263.  
  264. ;
  265. ; pascal OSErr NewSpeechChannel(VoiceSpecPtr voice, SpeechChannel *chan)
  266. ;
  267.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  268.         Macro
  269.         _NewSpeechChannel
  270.             move.l              #$0418000C,D0
  271.             dc.w                $A800
  272.         EndM
  273.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  274.         IMPORT_CFM_FUNCTION NewSpeechChannel
  275.     ENDIF
  276.  
  277. ;
  278. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  279. ;
  280.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  281.         Macro
  282.         _DisposeSpeechChannel
  283.             move.l              #$021C000C,D0
  284.             dc.w                $A800
  285.         EndM
  286.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  287.         IMPORT_CFM_FUNCTION DisposeSpeechChannel
  288.     ENDIF
  289.  
  290. ;
  291. ; pascal OSErr SpeakString(ConstStr255Param textToBeSpoken)
  292. ;
  293.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  294.         Macro
  295.         _SpeakString
  296.             move.l              #$0220000C,D0
  297.             dc.w                $A800
  298.         EndM
  299.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  300.         IMPORT_CFM_FUNCTION SpeakString
  301.     ENDIF
  302.  
  303. ;
  304. ; pascal OSErr SpeakText(SpeechChannel chan, const void *textBuf, unsigned long textBytes)
  305. ;
  306.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  307.         Macro
  308.         _SpeakText
  309.             move.l              #$0624000C,D0
  310.             dc.w                $A800
  311.         EndM
  312.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  313.         IMPORT_CFM_FUNCTION SpeakText
  314.     ENDIF
  315.  
  316. ;
  317. ; pascal OSErr SpeakBuffer(SpeechChannel chan, const void *textBuf, unsigned long textBytes, long controlFlags)
  318. ;
  319.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  320.         Macro
  321.         _SpeakBuffer
  322.             move.l              #$0828000C,D0
  323.             dc.w                $A800
  324.         EndM
  325.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  326.         IMPORT_CFM_FUNCTION SpeakBuffer
  327.     ENDIF
  328.  
  329. ;
  330. ; pascal OSErr StopSpeech(SpeechChannel chan)
  331. ;
  332.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  333.         Macro
  334.         _StopSpeech
  335.             move.l              #$022C000C,D0
  336.             dc.w                $A800
  337.         EndM
  338.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  339.         IMPORT_CFM_FUNCTION StopSpeech
  340.     ENDIF
  341.  
  342. ;
  343. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  344. ;
  345.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  346.         Macro
  347.         _StopSpeechAt
  348.             move.l              #$0430000C,D0
  349.             dc.w                $A800
  350.         EndM
  351.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  352.         IMPORT_CFM_FUNCTION StopSpeechAt
  353.     ENDIF
  354.  
  355. ;
  356. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  357. ;
  358.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  359.         Macro
  360.         _PauseSpeechAt
  361.             move.l              #$0434000C,D0
  362.             dc.w                $A800
  363.         EndM
  364.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  365.         IMPORT_CFM_FUNCTION PauseSpeechAt
  366.     ENDIF
  367.  
  368. ;
  369. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  370. ;
  371.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  372.         Macro
  373.         _ContinueSpeech
  374.             move.l              #$0238000C,D0
  375.             dc.w                $A800
  376.         EndM
  377.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  378.         IMPORT_CFM_FUNCTION ContinueSpeech
  379.     ENDIF
  380.  
  381. ;
  382. ; pascal short SpeechBusy(void )
  383. ;
  384.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  385.         Macro
  386.         _SpeechBusy
  387.             move.l              #$003C000C,D0
  388.             dc.w                $A800
  389.         EndM
  390.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  391.         IMPORT_CFM_FUNCTION SpeechBusy
  392.     ENDIF
  393.  
  394. ;
  395. ; pascal short SpeechBusySystemWide(void )
  396. ;
  397.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  398.         Macro
  399.         _SpeechBusySystemWide
  400.             move.l              #$0040000C,D0
  401.             dc.w                $A800
  402.         EndM
  403.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  404.         IMPORT_CFM_FUNCTION SpeechBusySystemWide
  405.     ENDIF
  406.  
  407. ;
  408. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  409. ;
  410.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  411.         Macro
  412.         _SetSpeechRate
  413.             move.l              #$0444000C,D0
  414.             dc.w                $A800
  415.         EndM
  416.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  417.         IMPORT_CFM_FUNCTION SetSpeechRate
  418.     ENDIF
  419.  
  420. ;
  421. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  422. ;
  423.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  424.         Macro
  425.         _GetSpeechRate
  426.             move.l              #$0448000C,D0
  427.             dc.w                $A800
  428.         EndM
  429.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  430.         IMPORT_CFM_FUNCTION GetSpeechRate
  431.     ENDIF
  432.  
  433. ;
  434. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  435. ;
  436.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  437.         Macro
  438.         _SetSpeechPitch
  439.             move.l              #$044C000C,D0
  440.             dc.w                $A800
  441.         EndM
  442.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  443.         IMPORT_CFM_FUNCTION SetSpeechPitch
  444.     ENDIF
  445.  
  446. ;
  447. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  448. ;
  449.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  450.         Macro
  451.         _GetSpeechPitch
  452.             move.l              #$0450000C,D0
  453.             dc.w                $A800
  454.         EndM
  455.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  456.         IMPORT_CFM_FUNCTION GetSpeechPitch
  457.     ENDIF
  458.  
  459. ;
  460. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, const void *speechInfo)
  461. ;
  462.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  463.         Macro
  464.         _SetSpeechInfo
  465.             move.l              #$0654000C,D0
  466.             dc.w                $A800
  467.         EndM
  468.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  469.         IMPORT_CFM_FUNCTION SetSpeechInfo
  470.     ENDIF
  471.  
  472. ;
  473. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  474. ;
  475.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  476.         Macro
  477.         _GetSpeechInfo
  478.             move.l              #$0658000C,D0
  479.             dc.w                $A800
  480.         EndM
  481.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  482.         IMPORT_CFM_FUNCTION GetSpeechInfo
  483.     ENDIF
  484.  
  485. ;
  486. ; pascal OSErr TextToPhonemes(SpeechChannel chan, const void *textBuf, unsigned long textBytes, Handle phonemeBuf, long *phonemeBytes)
  487. ;
  488.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  489.         Macro
  490.         _TextToPhonemes
  491.             move.l              #$0A5C000C,D0
  492.             dc.w                $A800
  493.         EndM
  494.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  495.         IMPORT_CFM_FUNCTION TextToPhonemes
  496.     ENDIF
  497.  
  498. ;
  499. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  500. ;
  501.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  502.         Macro
  503.         _UseDictionary
  504.             move.l              #$0460000C,D0
  505.             dc.w                $A800
  506.         EndM
  507.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  508.         IMPORT_CFM_FUNCTION UseDictionary
  509.     ENDIF
  510.  
  511.  
  512.  
  513.     ENDIF ; __SPEECHSYNTHESIS__ 
  514.  
  515.